package xia.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import xia.entity.Footballclub.Footballclub;
import xia.service.FootballclubService;

import java.util.List;

@Controller
@ResponseBody
@RequestMapping("/test")
public class TestController {
    @Autowired
    private FootballclubService service;
    @RequestMapping("/login")
    public List<Footballclub> login(){
        List<Footballclub> all = service.getAll();
        return all;
    }
    @RequestMapping("/selectByName/{name}")
    public Footballclub selectByName(@PathVariable String name){
        Footballclub f = new Footballclub();
        f.setClubname(name);
        return service.getOne(f);
    }

    @RequestMapping("/selectByAddress")
    public List<Footballclub> selectByAddress(@RequestParam("address") String address) {
        Footballclub f=new Footballclub();
        f.setAddress(address);
        return service.selectByAddress(f);
    }
}
